package com.xuecheng.manage_course.service.impl;

import com.xuecheng.framework.model.response.CommonCode;
import com.xuecheng.framework.model.response.ResponseResult;
import com.xuecheng.manage_course.entity.CoursePic;
import com.xuecheng.manage_course.mapper.CoursePicMapper;
import com.xuecheng.manage_course.service.CoursePicService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author testjava
 * @since 2020-12-31
 */
@Service
public class CoursePicServiceImpl extends ServiceImpl<CoursePicMapper, CoursePic> implements CoursePicService {


    @Autowired
    CoursePicMapper coursePicMapper;

    public CoursePic findCoursePic(String courseId) {
        return coursePicMapper.selectById(courseId);
    }

    public ResponseResult deleteCoursePic(String courseId) {
        int result = coursePicMapper.deleteById(courseId);
        if(result > 0){
            return new ResponseResult(CommonCode.SUCCESS);
        }
        return new ResponseResult(CommonCode.FAIL);
    }
}
